//
//  HotSonglistCollectionViewCell.m
//  LoveToListen
//
//  Created by dllo on 16/3/28.
//  Copyright © 2016年 LanOu. All rights reserved.
//

#import "HotSonglistCollectionViewCell.h"

@implementation HotSonglistCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.coverPic = [[UIImageView alloc] init];
        [self.contentView addSubview:_coverPic];
        self.name = [[UILabel alloc] init];
        [self.contentView addSubview:_name];
        self.author = [[UILabel alloc] init];
        [self.coverPic addSubview:_author];
        self.listenCount = [[UILabel alloc] init];
        [self.coverPic addSubview:_listenCount];
        self.detailImg = [[UIImageView alloc] init];
        [self.coverPic addSubview:_detailImg];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    _coverPic.frame = CGRectMake(0, 0, layoutAttributes.bounds.size.width, 115);
    
    _name.frame = CGRectMake(_coverPic.frame.origin.x, _coverPic.frame.origin.y + _coverPic.frame.size.height + 5, _coverPic.frame.size.width, layoutAttributes.bounds.size.height - _coverPic.frame.size.height);
    _name.numberOfLines = 2;
    
    _author.frame = CGRectMake(5, _coverPic.frame.size.height - 20, _coverPic.frame.size.width - 10, 20);
    _author.textColor = [UIColor whiteColor];
    _author.font = [UIFont systemFontOfSize:14];
    
    _listenCount.frame = CGRectMake(50, 5, 50, 20);
    _listenCount.textColor = [UIColor whiteColor];
    _listenCount.font = [UIFont systemFontOfSize:14];
    
    _detailImg.frame = CGRectMake(_listenCount.frame.origin.x - 20, _listenCount.frame.origin.y - 2.5 , 20, 20);
    _detailImg.image = [[UIImage imageNamed:@"iconfont-hotsonglist-listen"] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
    _detailImg.tintColor = [UIColor whiteColor];
    
}

@end
